﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=9" />
    <meta name="robots" content="noindex, nofollow" />
    <title></title>
    <link rel="shortcut icon" href="../images/logo/logo16_16.png" />
    <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="../ckeditor/ckeditor.js"></script>
    <script src="../ckfinder/ckfinder.js"></script>
</head>
<body>
    <form id="form" method="post">
        <center>
            <div class="container" style="width:70%">
                <div class="row clearfix" style=" text-align:left;">
                    <div class="col-md-12 column">
                        <div class="row clearfix">
                            <div class="col-md-12 column">
                                <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
                                    <div class="navbar-header">
                                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button> <a class="navbar-brand" href="../index.html">首页</a>
                                    </div>
                                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                                        <ul class="nav navbar-nav">
                                            <li>
                                                <a href="#">随笔杂记</a>
                                            </li>
                                            <li>
                                                <a href="#">学习笔记</a>
                                            </li>
                                            <li>
                                                <a href="#">代码片段</a>
                                            </li>
                                            <li>
                                                <a href="#">转载分享</a>
                                            </li>
                                            <li>
                                                <a href="#">关于博主</a>
                                            </li>
                                        </ul>
                                        <ul class="nav navbar-nav navbar-right" style=" padding-right:30px;">
                                            <li>
                                                <img src="../images/logo/logo48_48.ico" />
                                            </li>
                                            <li>
                                                <a href="#" style=" font-weight:bold; font-size:18px;">欢迎来到魔术猿-Vezn的个人博客</a>
                                            </li>
                                        </ul>
                                    </div>
                                </nav>
                            </div>
                        </div>                     
                        <div class="row clearfix" style="padding-top:100px;">
                           
                            <hr />
                            <div class="col-md-12 column">
                                <input type="text" id="txttitle" name="txttitle" value="请输入标题" style="width:60%" /><span style="color:red;font-size:18px;">*</span>
                            </div>
                        </div>
                        <div class="row clearfix" style="width:80%; padding-top:20px;">
                            <div class="col-md-12 column">
                                <div>
                                    <textarea class="ckeditor" id="editor1" name="editor1"></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-md-12 column">
                                <ul style=" list-style:none; font-size:16px;line-height:50px; padding-top:10px">
                                    <li >
                                        文章类别：
                                         <select id="seltype" name="seltype">
                                             <option value="0">请选择</option>
                                             <option value="1">随笔杂记</option>
                                             <option value="2">学习笔记</option>
                                             <option value="3">代码片段</option>
                                             <option value="4">转载分享</option>
                                         </select>
                                    </li>
                                    <li >文章标签：
                                        <input type="checkbox"   value="1" name="cklabel" />.NET&nbsp;&nbsp;
                                        <input type="checkbox"   value="2" name="cklabel" />SQL&nbsp;&nbsp;
                                        <input type="checkbox" value="3" name="cklabel" />JavaScript&nbsp;&nbsp;
                                        <input type="checkbox" value="4" name="cklabel" />Jquery&nbsp;&nbsp;
                                    </li>
                                    <li>
                                        是否置顶：
                                        <input type="radio" name="rdtop" value="1" />是
                                        <input type="radio" name="rdtop" value="0" checked="checked" />否
                                    </li>
                                    <li style="line-height:30px;">
                                        <input type="button" name="btncommit" id="btncommit" value="发布" style="width:10%" onclick="return commit();" />
                                        <input type="button" name="btndraft" id="btndraft" value="保存草稿" style="width:10%" onclick="return savedraft();" />
                                        <input type="reset" name="btnreset" id="btnreset" value="重置" style="width:10%" />
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="row clearfix">
                            <div class="col-md-12 column">
                            </div>
                        </div>

                    </div>
                    <div class="row clearfix" style=" padding:10px;text-align:center;">
                        <div class="col-md-12 column">
                            <hr>
                            <p>
                                闽ICP备16027414号  Copyright &copy; 2016-2016, <a href="http://veznwang.com/">魔术猿</a> - Vezn Wang. All rights reserved.
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </center>
    </form>
    <!--<script>
        CKEDITOR.editorConfig = function (config) {
            config.height = "1200";
        }
    </script>-->
    <script src="//cdn.ckeditor.com/4.5.6/standard-all/ckeditor.js"></script>
    <script type="text/javascript">

        if (typeof CKEDITOR !== 'undefined') {
           // CKEDITOR.addCss('img {max-width:100%; height: auto;}');
            //var editor = CKEDITOR.replace('editor1', {
            //   // extraPlugins: 'uploadimage,image2',
            //    removePlugins: 'image',
            //    height: 350
            //});

            // Just call CKFinder.setupCKEditor and pass the CKEditor instance as the first argument.
            // The second parameter (optional), is the path for the CKFinder installation (default = "/ckfinder/").
            //CKFinder.setupCKEditor('editor1');

            // It is also possible to pass an object with selected CKFinder properties as a second argument.
            // CKFinder.setupCKEditor( editor, { basePath : '../', skin : 'v1' } ) ;
        } else {
            document.getElementById('description').innerHTML = '<div class="tip-a tip-a-alert">This sample requires working Internet connection to load CKEditor from CDN.</div>'
        }

        $(document).ready(function () {
            var title = $("#txttitle").val();
            $("#txttitle").focus(function () {
                $("#txttitle").val("");
            });
            $("#txttitle").blur(function () {
                $("#txttitle").val(title);
            });

        });

        function commit() {
            if (confirm("确认发布此文章？")) {
                var msg = "";
                if ($("#txttitle").val() == "" || $("#txttitle").val() == "请输入标题") {
                    msg += "文章标题不能为空.\n";
                }
                if ($("#editor1").val() == "") {
                    msg += "文章内容不能为空.\n";
                }
                if ($("#seltype").val()=="0") {
                    msg += "文章类别不能为空.\n";
                }
                if (msg.length>0) {
                    alert("发布失败！\n" + msg);
                    return false;
                } else {
                    alert("发布成功！");
                    return true;
                }
            } else {
                alert("取消发布！");
                return false;
            }
        }

        function savedraft() {
            if (confirm("确认将文章保存草稿？")) {
                var msg = "";
                if ($("#txttitle").val() == "" || $("#txttitle").val() == "请输入标题") {
                    msg += "文章标题不能为空.\n";
                }
                if ($("#editor1").val() == "") {
                    msg += "文章内容不能为空.\n";
                }
                if (msg.length > 0) {
                    alert("保存失败！\n" + msg);
                    return false;
                } else {
                    alert("保存成功！");
                    return true;
                }
            } else {
                alert("取消保存！");
                return false;
            }
        }

       

    </script>
</body>
</html>
